package com.motorola.dp.jenkinsmonitor.jettyserver;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;

import com.motorola.dp.jenkinsmonitor.service.util.properties.ClasspathPropertiesService;
import com.motorola.dp.jenkinsmonitor.service.util.properties.PropertiesService;

public final class Main {

    private Main() {
        super();
    }

    public static void main(String[] args) throws Exception {
        PropertiesService propsService = new ClasspathPropertiesService("jetty.properties");

        String contextFolder = propsService.getString("jetty.contextFolder");
        Integer port = propsService.getInteger("jetty.port");

        Server server = new Server(port);

        WebAppContext webapp = new WebAppContext();
        webapp.setContextPath("/");
        webapp.setWar(contextFolder);
        server.setHandler(webapp);

        server.start();
        server.join();
    }

}
